// autofree engine:
//   the compiler inserts necessary free calls automaticalyy duration compilation
//   remaining small percentage of objects is freed via reference counting
// V avoids doing unnecessary allocations in the first place, by using
//   value types
//   string buffers

// define a `free()` method on custom data types
// it will statically insert `free()` calls at the end of each variable's lifetime
struct MyType {}

[unsafe]
fn (data &MyType) free() {
	// ...
}

struct User {
	name string
}

fn test() []int {
	number := 7          // stack variable
	user := User{}       // struct allocated on stack
	numbers := [1, 2, 3] // array allocated on heap, will be freed as the function exits
	println(number)
	println(user)
	println(numbers)
	numbers2 := [4, 5, 6] // array that's being returned, won't be freed here
	return numbers2
}
